<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ES6字符串</title>
</head>
<body>
	<script>
		console.log(str);
		var str="Hello world";
		let str1="Hello";
		console.log(str.indexOf("r"));
		console.log(str.includes(""));
		console.log(str.startsWith("H"));
		console.log(str.endsWith("l"));
		console.log(str.repeat(3));//返回一个重复排列的新的字符串
		console.log(str.repeat(3.1));//参数是小数向前取整
		console.log(str.repeat(3.5));//参数是小数向前取整
		console.log(str.repeat(-0.1));//参数如果在0到-1之间取0
 //		console.log(str.repeat(-1));参数 <-1报错
		//字符串补全功能 padStart(),padEnd()
		console.log(str.padStart(20,"ab"));
		console.log(str.padEnd(20,"ab"));
		console.log(str.padStart(20));//省略第二个参数将会使用空格补全
		//模板字符串小撇号  ``
		$('#result').append(`
  			There are <b>${basket.count}</b> items
   			in your basket, <em>${basket.onSale}</em>
  			are on sale!
			`);
	</script>
</body>
</html>
